<template>
	<view style="width:100%;height:130rpx;"></view>
	<view class="shopBut">
		<view class="for"><text>实付</text><text>¥</text><text>{{addNums=='0'?money:'0.00'}}</text></view>
		<view  class="flex-end">
			<!-- #ifdef H5 -->
			<text class="shares" v-if="share" @click="sharePop()">{{share}}</text>
			<!-- #endif -->
			<!-- #ifndef H5 -->
			<button class="shares" open-type="share" v-if="share">分享</button>
			<!-- #endif -->
		    <text :class="empty?'pays':'pay'" @click="submit()" :style="{background:bagCar?'#07C160':''}">{{title}}</text>
		</view>
	</view>
</template>

<script setup lang="ts">
	import { ref } from 'vue';
	import { onLoad,onShareAppMessage,onShareTimeline  } from '@dcloudio/uni-app';
	import { getDriverID } from '@/stores/driverID';
	import { poster3 } from '@/utils/Static';
	const driver_id = getDriverID();
	const props = defineProps({
	  title: { type: String },
	  share: { type: String },
	  empty:{ type: Boolean },
	  money:{ type: String },
	  addNums:{ type: String },
	  bagCar:{ type: Boolean },
	});
	const emit = defineEmits(['submit','sharePop']);
	function submit(){
		emit('submit')
	}
	function sharePop(){
		emit('sharePop')
	}
	const groupID=ref('')
	const teamID=ref('')
	onLoad((pearm)=>{
		groupID.value=pearm.id
		teamID.value=pearm.team
		//设置下方的Menus菜单，才能够让发送给朋友与分享到朋友圈两个按钮可以点击
		 // #ifdef MP-WEIXIN
		uni.showShareMenu({
		  withShareTicket: true,
		  menus: ['shareAppMessage', 'shareTimeline'],
		});
		// #endif
	})
	// 分享好友
	onShareAppMessage((res) => {
		if(res.from==='button'){
			console.log(res.target)
		}
	  return {
	    title: '安蓝车用尿素互联网整体解决方案',
	    path: `/pages/groupBenefits/shareGroupDetail?fxID=${driver_id}&id=${groupID.value}&team=${teamID.value}`,
	    imageUrl:poster3,
	    desc: '品牌直销 大厂品质 国六标准 车用尿素溶液自助加注',
	  };
	});
	//分享到朋友圈
	onShareTimeline(() => {
	  return {
	    title: '安蓝车用尿素互联网整体解决方案',
	    path: `/pages/groupBenefits/shareGroupDetail?fxID=${driver_id}&id=${groupID.value}&team=${teamID.value}`,
	    imageUrl:poster3,
	    desc: '品牌直销 大厂品质 国六标准 车用尿素溶液自助加注',
	  };
	});
</script>

<style scoped lang="less">
	@import url('../groupBenefits/less/shopBot.less');
</style>